# coding: utf-8
from multiprocessing import Process,Queue
import os,time

def write(q):
    print('write Process %s is running...'% os.getpid())
    for x in ['python','c','java','php']:
        q.put(x)
        print('write to Queue :'%x)
def read(q):
    print('read Process %s is running...' % os.getpid())
    while True:
        r = q.get(True)
        print('read from Queue : %s' %r)
    pass


if __name__ == '__main__':
    print('MainProcess %s is running...'% os.getpid())
    q = Queue()
    p1 = Process(target=write,args=(q,))
    p2 = Process(target=read,args=(q,))
    p1.start()
    p2.start()
    p1.join()
    p2.join()
    